/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<int> a(n),b(n);
for(int i=0; i<n; i++){
cin >> a[i];
}
for(int i=0; i<n; i++){
cin >> b[i];
}
int start = 0;
int end = 1;
bool notSorted = false;
int ans = 0;
int p1, p2;
while(end < n){
notSorted = false;
while(end < n and b[end] >= b[end-1]){
if(a[end] < a[end-1]) notSorted = true;
end++;
}
if(notSorted){
ans = max(ans, end-start);
p1 = start+1;
p2 = end;
}
start = end;
end++;
}
cout << p1 << " " << p2 << "\n";
}
}
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |
e-maze-in | Bricks Game |